 package com.neusoft.elmboot.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.neusoft.elmboot.po.User;
import org.apache.ibatis.annotations.Update;

 @Mapper
public interface UserMapper {
	 @Select("select * from user where userId=#{userId} and password=#{password}")
	 public User getUserByIdByPass(User user);
	 
	 @Select("select count(*) from user where userId=#{userId}")
	 public int getUserById(String userId);
	 
	 @Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},null,1,0,#{userRole})")
	 public int saveUser(User user);

	 @Update("update user set credit=#{credit} where userId=#{userId}")
	 public int UpdateCredit(String userId, Integer credit);

	 @Update("update user set userName=#{userName},userSex=#{userSex} where userId=#{userId}")
	 int updateUserInfo(User user);

	 @Update("update user set password=#{password} where userId=#{userId}")
	 int updateUserPass(User user);
	 
	 @Update("select userRole from user where userId=#{userId} and password=#{password}")
	 int getUserRoleById(User user);
	 
	 @Select("select userName from user where userId=#{userId}")
	 public String getUserInfoById(String userId);
 }
